﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.model;
using l1cs.server.datatables;
using l1cs.server.templates;
using l1cs.server.serverpackets;

namespace l1cs.server.clientpackets
{
    public class C_ChangeWarTime : ClientBasePacket
    {
        private const String _C_CHANGE_WAR_TIME = "[C] C_ChangeWarTime";
        private static Logger _log = Logger.getLogger( typeof( C_ChangeWarTime ).FullName );

        public C_ChangeWarTime( byte[] abyte0, ClientThread clientthread )
            : base( abyte0 )
        {

            L1PcInstance player = clientthread.getActiveChar();

            L1Clan clan = L1World.getInstance().getClan( player.getClanname() );
            if ( clan != null )
            {
                int castle_id = clan.getCastleId();
                if ( castle_id != 0 )
                { // 城主クラン
                    L1Castle l1castle = CastleTable.getInstance().getCastleTable( castle_id );
                    DateTime dateTime = l1castle.getWarTime();
                    player.sendPackets( new S_WarTime( dateTime ) );
                }
            }
        }

        override
        public String getType()
        {
            return _C_CHANGE_WAR_TIME;
        }
    }
}